package ca.etsmtl.log430.lab2;

/**
 * This class defines the Course object for the system.
 * 
 * @author A.J. Lattanze, CMU
 * @version 1.3, 2011-Feb-02
 */

/*
 * Modification Log **********************************************************
 * 
 * v1.3, R. Champagne, 2011-Feb-02 - Various refactorings, conversion of
 * comments to javadoc format.
 * 
 * v1.2, R. Champagne, 2002-May-21 - Adapted for use at ETS.
 * 
 * v1.1, G.A.Lewis, 01/25/2001 - Bug in second constructor. Removed null
 * assignment to courseID after being assigned a value.
 * 
 * v1.0, A.J. Lattanze, 12/29/99 - Original version.
 * ***************************************************************************
 */

public class Course implements Comparable<Course>{

	/**
	 * Course title
	 */
	private String courseName;

	/**
	 * Course number
	 */
	private String courseID;

	/**
	 * Course section (group)
	 */
	private String section;

	/**
	 * Days the course will be held on
	 */
	private String days;

	/**
	 * Start time of the course
	 */
	private String startTime;

	/**
	 * Stop time of the course
	 */
	private String stopTime;

	/**
	 * Instructor Name
	 */
	private String instructor;

	/**
	 * List of students registered for the course
	 */
	private StudentList registeredStudents = new StudentList();

	public Course() {

		this.setCourseID(null);
		this.setCourseName(null);
		this.setCourseID(null);
		this.setSection(null);
		this.setDays(null);
		this.setStartTime(null);
		this.setStopTime(null);
		this.setInstructor(null);

	} // Constructor

	public Course(String CourseID) {

		this.setCourseID(CourseID);
		this.setCourseName(null);
		this.setSection(null);
		this.setDays(null);
		this.setStartTime(null);
		this.setStopTime(null);
		this.setInstructor(null);

	} // Constructor

	/**
	 * Register a student for a class.
	 * 
	 * @param StudentObject
	 * @return true if the registration is successful, false otherwise.
	 */
	public boolean registerStudent(Student StudentObject) {

		if (registeredStudents.findStudent(StudentObject)) {

			return (false);

		} else {

			registeredStudents.addStudent(StudentObject);
			return (true);

		} // if

	} // RegisterStudent

	/**
	 * Register a student for a class.
	 * 
	 * @param StudentObject
	 */
	public void register(Student StudentObject) {

		registeredStudents.addStudent(StudentObject);

	} // Register

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseID(String courseID) {
		this.courseID = courseID;
	}

	public String getCourseID() {
		return courseID;
	}

	public void setSection(String section) {
		this.section = section;
	}

	public String getSection() {
		return section;
	}

	public void setDays(String days) {
		this.days = days;
	}

	public String getDays() {
		return days;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStopTime(String stopTime) {
		this.stopTime = stopTime;
	}

	public String getStopTime() {
		return stopTime;
	}

	public void setInstructor(String instructor) {
		this.instructor = instructor;
	}

	public String getInstructor() {
		return instructor;
	}

	public StudentList getRegisteredStudents() {
		return registeredStudents;
	}

	public void setRegisteredStudents(StudentList registered) {
		registeredStudents = registered;
	}

    @Override
    public int compareTo(Course o) {
        if(o.getCourseID() == this.courseID)
            return 0;
        else 
        	return 1;
    }
    
    public String toString(){
    	
    	return this.getCourseID();
    }

} // Course class
